<!DOCTYPE html>
<html lang="en">

<head>
  @@include('./meta.html',{
    "select2": true
  })
</head>

<body class="app-component">
  @@include('./header.html',{
  "components": "active"
  })
  <div class="component-wrapper">
    <div class="component-navleft">
      @@include('./navleft.html',{
      "tab_form": "active"
      })
    </div><!-- component-navleft -->

    <div class="component-sidebar">
      @@include('./sidebar.html',{
      "tab_form": "active",
      "form_select2": "active",
      "urlPrefix": "."
      })
    </div><!-- component-sidebar -->

      <div class="component-content">
        <div class="component-content-header">
          <nav aria-label="breadcrumb">
            <ol class="breadcrumb breadcrumb-style1 mg-b-0">
              <li class="breadcrumb-item"><a href="#">Components</a></li>
              <li class="breadcrumb-item"><a href="#">Forms</a></li>
              <li class="breadcrumb-item active" aria-current="page">Select2</li>
            </ol>
          </nav>
          <a href="javascript:;" id="componentOptions" class="text-secondary mg-l-auto d-xl-none"><i data-feather="more-horizontal"></i></a>
        </div><!-- component-content-header -->

        <div class="component-content-body" data-spy="scroll" data-target="#navSection" data-offset="120">
          <div class="content content-components">
            <div class="container">
              <!--sd-->
              <h1 class="td-title">Select2</h1>
        <p class="td-lead">Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and pagination (infinite scrolling) of results. Read the <a href="https://select2.org/" target="_blank">Official Select2 Documentation</a> for a full list of instructions and other options.</p>

        <hr class="mg-y-40">

        <h4 id="section1" class="mg-b-10">Basic Usage</h4>
        <p class="mg-b-30">Select2 was designed to be a replacement for the standard <code>&lt;select&gt;</code> box that is displayed by the browser. By default it supports all options and operations that are available in a standard select box, but with added flexibility.</p>

        <div data-label="Example" class="td-example demo-forms">
          <div class="wd-md-50p">
            <select class="form-control select2-no-search">
              <option label="Choose one"></option>
              <option value="Firefox">Firefox</option>
              <option value="Chrome">Chrome</option>
              <option value="Safari">Safari</option>
              <option value="Opera">Opera</option>
              <option value="Internet Explorer">Internet Explorer</option>
            </select>
          </div>
        </div><!-- td-example -->
        <pre><code class="language-js">$(&apos;.select2&apos;).select2();</code></pre>

        <hr class="mg-t-50 mg-b-40">

        <h4 id="section2" class="mg-b-10">With Search</h4>
        <p class="mg-b-30">Select2 by default does have a search box displayed but most of the time this template uses select2 without a search.</p>

        <div data-label="Example" class="td-example demo-forms">
          <div class="wd-md-50p">
            <select class="form-control select2">
              <option label="Choose one"></option>
              <option value="Firefox">Firefox</option>
              <option value="Chrome">Chrome</option>
              <option value="Safari">Safari</option>
              <option value="Opera">Opera</option>
              <option value="Internet Explorer">Internet Explorer</option>
            </select>
          </div>
        </div><!-- td-example -->
        <pre><code class="language-js">$(&apos;.select2&apos;).select2({
  placeholder: &apos;Choose one&apos;,
  searchInputPlaceholder: &apos;Search options&apos;
});</code></pre>

        <hr class="mg-t-50 mg-b-40">

        <h4 id="section3" class="mg-b-10">Disabled State</h4>
        <p class="mg-b-30">Select2 will respond to the disabled attribute on select elements. You can also initialize Select2 with <code>disabled: true</code> to get the same effect.</p>

        <div data-label="Example" class="td-example demo-forms">
          <div class="wd-md-50p">
            <select class="form-control select2" disabled>
              <option label="Choose one"></option>
              <option value="Firefox">Firefox</option>
              <option value="Chrome">Chrome</option>
              <option value="Safari">Safari</option>
              <option value="Opera">Opera</option>
              <option value="Internet Explorer">Internet Explorer</option>
            </select>
          </div>
        </div><!-- td-example -->
        <pre><code class="language-html">&lt;select class=&quot;form-control select2&quot; disabled&gt;...&lt;/select&gt;</code></pre>

        <hr class="mg-t-50 mg-b-40">

        <h4 id="section4" class="mg-b-10">Multiple Box</h4>
        <p class="mg-b-30">Select2 also supports multi-value select boxes. The select below is declared with the multiple attribute.</p>

        <div data-label="Example" class="td-example demo-forms">
          <div class="wd-md-80p">
            <select class="form-control select2" multiple="multiple">
              <option label="Choose one"></option>
              <option value="Firefox">Firefox</option>
              <option value="Chrome" selected>Chrome</option>
              <option value="Safari">Safari</option>
              <option value="Opera">Opera</option>
              <option value="Internet Explorer" selected>Internet Explorer</option>
            </select>
          </div>
        </div><!-- td-example -->
        <pre><code class="language-html">&lt;select class=&quot;form-control select2&quot; multiple=&quot;multiple&quot;&gt;...&lt;/select&gt;</code></pre>

        <hr class="mg-t-50 mg-b-40">

        <h4 id="section5" class="mg-b-10">Clearable Selection</h4>
        <p class="mg-b-30">When set to true, causes a clear button close icon to appear on the select box when a value is selected. Clicking the clear button will clear the selected value, effectively resetting the select box back to its placeholder value.</p>

        <div data-label="Example" class="td-example demo-forms">
          <div class="wd-md-60p">
            <select class="form-control select2-clear">
              <option label="Choose one"></option>
              <option value="Firefox">Firefox</option>
              <option value="Chrome">Chrome</option>
              <option value="Safari">Safari</option>
              <option value="Opera">Opera</option>
              <option value="Internet Explorer">Internet Explorer</option>
            </select>
          </div>
        </div><!-- td-example -->
        <pre><code class="language-js">$(&apos;.select2&apos;).select2({
  placeholder: &apos;Choose one&apos;,
  allowClear: true
});</code></pre>

        <hr class="mg-t-50 mg-b-40">

        <h4 id="section6" class="mg-b-10">Limit Selection</h4>
        <p class="mg-b-30">Select2 multi-value select boxes can set restrictions regarding the maximum number of options that can be selected. </p>

        <div data-label="Example" class="td-example demo-forms">
          <div class="wd-md-60p">
            <select class="form-control select2-limit" multiple="multiple">
              <option label="Choose one"></option>
              <option value="Firefox">Firefox</option>
              <option value="Chrome">Chrome</option>
              <option value="Safari">Safari</option>
              <option value="Opera">Opera</option>
              <option value="Internet Explorer">Internet Explorer</option>
            </select>
          </div>
        </div><!-- td-example -->
        <pre><code class="language-js">$(&apos;.select2&apos;).select2({
  placeholder: &apos;Choose one&apos;,
  maximumSelectionLength: 2
});</code></pre>
@@include('./footer.html',{})

            </div>
          </div>
        </div><!-- component-content-body -->

        <div class="component-content-sidebar section-nav">
          <label class="tx-10 tx-medium tx-spacing-1 tx-color-03 tx-uppercase tx-sans mg-b-15">On This Page</label>
          <nav id="navSection" class="nav flex-column">
            <a href="#section1" class="nav-link">Basic Usage</a>
            <a href="#section2" class="nav-link">With Search</a>
            <a href="#section3" class="nav-link">Disabled State</a>
            <a href="#section4" class="nav-link">Multiple Box</a>
            <a href="#section5" class="nav-link">Clearable Selection</a>
            <a href="#section6" class="nav-link">Limit Selection</a>
          </nav>
        </div><!-- component-content-sidebar -->
      </div><!-- component-content -->

    </div><!-- component-wrapper -->


    @@include('./_script.html',{})

    <script src="../lib/select2/js/select2.min.js"></script>

    <script>
     // Adding placeholder for search input
     (function($) {

'use strict'

var Defaults = $.fn.select2.amd.require('select2/defaults');

$.extend(Defaults.defaults, {
  searchInputPlaceholder: ''
});

var SearchDropdown = $.fn.select2.amd.require('select2/dropdown/search');

var _renderSearchDropdown = SearchDropdown.prototype.render;

SearchDropdown.prototype.render = function(decorated) {

  // invoke parent method
  var $rendered = _renderSearchDropdown.apply(this, Array.prototype.slice.apply(arguments));

  this.$search.attr('placeholder', this.options.get('searchInputPlaceholder'));

  return $rendered;
};

})(window.jQuery);


$(function(){
'use strict'

// Basic with search
$('.select2').select2({
  placeholder: 'Choose one',
  searchInputPlaceholder: 'Search options'
});

// Disable search
$('.select2-no-search').select2({
  minimumResultsForSearch: Infinity,
  placeholder: 'Choose one'
});

// Clearable selection
$('.select2-clear').select2({
  minimumResultsForSearch: Infinity,
  placeholder: 'Choose one',
  allowClear: true
});

// Limit selection
$('.select2-limit').select2({
  minimumResultsForSearch: Infinity,
  placeholder: 'Choose one',
  maximumSelectionLength: 2
});

});
    </script>
  </body>
</html>
